from django.db import models

# Create your models here.

#公司
class ExCompany(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255,help_text="公司名称")
    formerName = models.TextField(help_text="曾用名")
    type = models.CharField(max_length=255,help_text="企业性质")
    address = models.CharField(max_length=255,help_text="注册地址")
    capital = models.FloatField(help_text="注册资金（万元）")
    totalNumber = models.IntegerField(help_text="总人数（技术人员数）")
    website = models.CharField(max_length=255,help_text="企业网址")
    postalCode = models.CharField(max_length=255,help_text="邮政编码")
    unifiedSocialCreditCode = models.CharField(max_length=255,help_text="统一社会信用代码")
    taxpayerIdentityNumber = models.CharField(max_length=255,help_text="纳税人识别号")
    bank = models.CharField(max_length=255,help_text="基本账户开户行")
    bankAccount = models.CharField(max_length=255,help_text="基本账户账号")
    creditProfile = models.CharField(max_length=255,help_text="信用状况")
    other = models.CharField(max_length=255,help_text="其他")
    synopsis = models.TextField(help_text="简介")

    class Meta:
        db_table = 'ex_company'

#公司关联企业表
class ExAffiliates(models.Model):
    id = models.AutoField(primary_key=True) #help_text="合作伙伴名称备注"
    name = models.CharField(max_length=255,help_text="上级/下级/兄弟单位名称")
    type = models.CharField(max_length=255,help_text="类型（上级/下级/兄弟）")
    investmentPercent = models.IntegerField(help_text="出资比例（%）")
    companyHead = models.CharField(max_length=255,help_text="单位负责人")
    contactPhone = models.CharField(max_length=255,help_text="联系人及电话")
    companyAddress = models.CharField(max_length=255,help_text="单位地址")


    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")

    class Meta:
        db_table = 'ex_affiliates'

#公司财务状况表
class ExFinance(models.Model):
    id = models.AutoField(primary_key=True)
    year = models.IntegerField(help_text="年份")
    totalAssets = models.FloatField(help_text="总资产（万元）")
    netAssets = models.FloatField(help_text="净资产（万元）")
    currentAssets = models.FloatField(help_text="流动资产（万元）")
    totalLiabilities = models.FloatField(help_text="总负债（万元）")
    currentLiabilities = models.FloatField(help_text="流动负债（万元）")
    operatingIncome = models.FloatField(help_text="营业收入（万元）")
    netProfit = models.FloatField(help_text="净利润（万元）")
    operatingNetProfitMargin = models.FloatField(help_text="营业净利率")
    netCashFlow = models.FloatField(help_text="现金净流量（万元）")
    netCashFlowRatio = models.FloatField(help_text="净现金流动比率")
    totalProfit = models.FloatField(help_text="利润总额（万元）")


    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")

    class Meta:
        db_table = 'ex_finance'

#部门
class ExDept(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255,help_text="部门名称")
    
    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")

    class Meta:
        db_table = 'ex_dept'

#文件
class ExFile(models.Model):
    id = models.AutoField(primary_key=True)
    # objectType = models.CharField(max_length=255,help_text="单位地址")
    # objectId = models.IntegerField(help_text="单位地址")
    path = models.CharField(max_length=255,help_text="文件路径")
    type = models.CharField(max_length=255,help_text="文件类型")
    comment = models.TextField(help_text="备注")
    uploadDate = models.DateTimeField(help_text="文件上传时间")

    class Meta:
        db_table = 'ex_file'

#公司法人信息
class ExLegalAgents(models.Model):
    id = models.AutoField(primary_key=True)
    account = models.CharField(max_length=255, unique=True,help_text="用户名")
    name = models.CharField(max_length=255,help_text="姓名")
    birthday = models.DateField(help_text="出生日期")
    position = models.CharField(max_length=255, default='',help_text="职务")
    sex = models.CharField(max_length=255,help_text="性别")
    type = models.CharField(max_length=255,help_text="类型（法人或代表人）")
    phone = models.CharField(max_length=255,help_text="联系电话")
    email = models.CharField(max_length=255, default='',help_text="电子邮箱")
    fax = models.CharField(max_length=255, default='',help_text="传真")

    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")
    dept = models.ForeignKey(ExDept, on_delete=models.PROTECT, db_column='dept',
                                null=True, blank=True,help_text="部门id")
    IDCardFront = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='IDCardFront',
                                    null=True, blank=True, help_text="身份证正面id", related_name='LegalAgents_IDCardFront')
    IDCardBack = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='IDCardBack',
                                   null=True, blank=True, help_text="身份证反面id", related_name='LegalAgents_IDCardBack')

    class Meta:
        db_table = 'ex_legalAgent'

#公司失信情况
class ExPromise(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255,help_text="名称")
    parentPath = models.CharField(max_length=255,help_text="父路径，默认为一级节点，即为空")
    order=models.IntegerField(help_text="节点顺序")

    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")
    file = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='file',
                             null=True, blank=True,help_text="附件id")

    class Meta:
        db_table = 'ex_promise'

#成员
class ExTeam(models.Model):
    id = models.AutoField(primary_key=True)
    account = models.CharField(max_length=255, unique=True,help_text="用户名")
    name = models.CharField(max_length=255,help_text="姓名")
    sex = models.CharField(max_length=255,help_text="性别")
    birthday = models.DateField(help_text="出生日期")
    idNumber = models.CharField(max_length=255,help_text="身份证号")
    workYears = models.IntegerField(help_text="工作年限")
    university = models.CharField(max_length=255,help_text="毕业学校")
    degree = models.CharField(max_length=255,help_text="学位")
    professional = models.CharField(max_length=255,help_text="职称")
    professionalNumber = models.CharField(max_length=255,help_text="职称编号")

    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")
    dept = models.ForeignKey(ExDept, on_delete=models.PROTECT, db_column='dept',
                                null=True, blank=True,help_text="部门id")
    degreeFile = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='degreeFile',
                                null=True, blank=True,help_text="学位附件id")
    IDCardFront = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='IDCardFront',
                                    null=True, blank=True, help_text="身份证正面id",related_name='Team_IDCardFront')
    IDCardBack = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='IDCardBack',
                                   null=True, blank=True, help_text="身份证反面id",related_name='Team_IDCardBack')

    class Meta:
        db_table = 'ex_team'

#招标文件
class ExBidParse(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255,help_text="招标文件名称")
    projectName = models.CharField(max_length=255,help_text="招标项目名称")
    projectCode = models.CharField(max_length=255,help_text="采购编号/项目编号")
    bidOpenTime = models.DateTimeField(help_text="开标时间")
    type = models.CharField(max_length=255,help_text="招标类型")
    status = models.CharField(max_length=255,help_text="招标文件解析状态")
    text = models.TextField(help_text="解析文本")
    createDate = models.DateTimeField(help_text="创建时间")

    createBy = models.ForeignKey(ExTeam, on_delete=models.PROTECT, db_column='createBy',
                                 to_field='account', null=True, blank=True,help_text="创建用户")
    file = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='file',
                                   null=True, blank=True,help_text="上传文件id")

    class Meta:
        db_table = 'ex_bidParse'

class ExBidPackage(models.Model):
    id = models.AutoField(primary_key=True)
    parent = models.IntegerField(help_text="标的（标包对应的标的）id")
    name = models.CharField(max_length=255,help_text="标的/标包名称")
    review = models.CharField(max_length=255,help_text="详细评审标准")
    special = models.CharField(max_length=255,help_text="专用资格要求")

    bid_parse = models.ForeignKey(ExBidParse, on_delete=models.PROTECT, db_column='bid_parse',
                                null=True, blank=True,help_text="招标项目id")

    class Meta:
        db_table = 'ex_bidPackage'

#投标生成表
class ExBid(models.Model):
    id = models.AutoField(primary_key=True)
    bidOpenTime = models.DateTimeField(help_text="开标时间")
    projectName = models.CharField(max_length=255,help_text="招标项目名称")
    projectCode = models.CharField(max_length=255,help_text="采购编号/项目编号")
    projectHeadPhone = models.CharField(max_length=255,help_text="投标负责人及联系方式")
    status = models.CharField(max_length=255, default='',help_text="文件生成状态")
    techStatus = models.CharField(max_length=255, default='',help_text="技术文件生成状态")
    businessStatus = models.CharField(max_length=255, default='',help_text="商务文件生成状态")

    bidParse = models.ForeignKey(ExBidParse, on_delete=models.PROTECT, db_column='bidParse',
                                null=True, blank=True,help_text="招标文件解析id")
    createBy = models.ForeignKey(ExTeam, on_delete=models.PROTECT, db_column='createBy',
                                to_field='account', null=True, blank=True,help_text="创建人")
    dept = models.ForeignKey(ExDept, on_delete=models.PROTECT, db_column='dept',
                                 null=True, blank=True,help_text="投标部门id")
    bidder = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='bidder',
                                null=True, blank=True,help_text="投标人")
    pmProject = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='pmProject',
                                null=True, blank=True, related_name='bid_pmProject',help_text="负责人业绩生成附件id")
    project = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='project',
                                  null=True, blank=True, related_name='bid_project',help_text="业绩生成附件id")
    team = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='team',
                                  null=True, blank=True, related_name='bid_team',help_text="团队生成附件id")
    agent = models.ForeignKey(ExLegalAgents, on_delete=models.PROTECT, db_column='agent',
                                to_field='account', null=True, blank=True,help_text="委托代理人")
    target = models.ForeignKey(ExBidPackage, on_delete=models.PROTECT, db_column='target',
                                  null=True, blank=True, related_name='bid_target',help_text="标的id")
    package = models.ForeignKey(ExBidPackage, on_delete=models.PROTECT, db_column='package',
                                  null=True, blank=True, related_name='bid_package',help_text="标包id")

    class Meta:
        db_table = 'ex_bid'

#投标文件生成目录数据表
class ExBidCatalog(models.Model):
    id = models.AutoField(primary_key=True)
    uuid = models.CharField(max_length=32,help_text="唯一标识符")
    type = models.CharField(max_length=255,help_text="文件类型，分为tech（技术）和business（商务）")
    name = models.CharField(max_length=255,help_text="标题名称（文件名）")
    order = models.IntegerField(help_text="标题顺序")

    bid = models.ForeignKey(ExBid, on_delete=models.PROTECT, db_column='bid',
                                null=True, blank=True,help_text="投标任务id")
    sourceFile = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='sourceFile',
                      null=True, blank=True, related_name='sourceFile',help_text="模板文件id")
    generateFile = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='generateFile',
                                   null=True, blank=True, related_name='generateFile',help_text="生成文件id")

    class Meta:
        db_table = 'ex_bidCatalog'

# #投标文件生成目录数据表
# class ExBidCatalog(models.Model):
#     id = models.AutoField(primary_key=True)
#     uuid = models.CharField(max_length=32,help_text="单位地址")
#     type = models.CharField(max_length=255,help_text="单位地址")
#     name = models.CharField(max_length=255,help_text="单位地址")
#     generateFlag = models.CharField(max_length=1, default='1',help_text="单位地址")
#     genarateContent = models.TextField(default='',help_text="单位地址")
#     originalContent = models.TextField(default='',help_text="单位地址")
#     path = models.CharField(max_length=255,help_text="单位地址")
#     order = models.IntegerField(help_text="单位地址")
#
#     bid = models.ForeignKey(ExBid, on_delete=models.PROTECT, db_column='bid',
#                                 null=True, blank=True,help_text="单位地址")
#
#     class Meta:
#         db_table = 'ex_bidCatalog'

#投标团队职务
class ExBidTeam(models.Model):
    id = models.AutoField(primary_key=True)
    position = models.CharField(max_length=255,help_text="职务")

    account = models.ForeignKey(ExTeam, on_delete=models.PROTECT, db_column='account',
                                to_field='account', null=True, blank=True,help_text="用户名")
    bid = models.ForeignKey(ExBid, on_delete=models.PROTECT, db_column='bid',
                                null=True, blank=True,help_text="投标任务id")

    class Meta:
        db_table = 'ex_bidTeam'

#投标团队社保缴纳证明
class ExBidSocialInsurance(models.Model):
    id = models.AutoField(primary_key=True)
    year = models.IntegerField(help_text="社保缴纳记录所属年")
    month = models.IntegerField(help_text="社保缴纳记录所属月")


    file = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='file',
                                  null=True, blank=True,help_text="社保缴纳记录附件id")
    bid = models.ForeignKey(ExBid, on_delete=models.PROTECT, db_column='bid',
                                null=True, blank=True,help_text="投标任务id")

    class Meta:
        db_table = 'ex_bidSocialInsurance'

#个人社保缴纳证明
class ExTeamSocialInsurance(models.Model):
    id = models.AutoField(primary_key=True)
    year = models.IntegerField(help_text="社保缴纳记录年份")
    month = models.IntegerField(help_text="社保缴纳记录月份")


    file = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='file',
                                  null=True, blank=True,help_text="社保缴纳记录附件id")
    account = models.ForeignKey(ExTeam, on_delete=models.PROTECT, db_column='account',
                                to_field='account', null=True, blank=True,help_text="用户名")

    class Meta:
        db_table = 'ex_teamSocialInsurance'

#公司项目
class ExProject(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255,help_text="业绩（项目）名称")
    code = models.CharField(max_length=255,help_text="业绩（项目）编号")
    contractName = models.CharField(max_length=255,help_text="合同名称")
    acceptanceDate = models.DateField(help_text="验收日期")
    begin = models.DateField(help_text="开始日期")
    address = models.CharField(max_length=255,help_text="业绩（项目）地点")
    businessType = models.CharField(max_length=255,help_text="业绩（项目）业务类型，以','分割")
    techType = models.CharField(max_length=255,help_text="业绩（项目）技术类型")
    techKeywords = models.CharField(max_length=255,help_text="业绩（项目）技术关键词，以','分割")
    counterpartName = models.CharField(max_length=255,help_text="对方名称")
    contractSignDate = models.DateField(help_text="合同签订日期")
    counterpartContact = models.CharField(max_length=255,help_text="对方联系人")
    counterpartPhone = models.CharField(max_length=255,help_text="对方电话")
    contractAmount = models.FloatField(help_text="合同金额（万元）")
    desc = models.TextField(help_text="业绩（项目）描述")
    comment = models.TextField(help_text="备注")

    PM = models.ForeignKey(ExTeam, on_delete=models.PROTECT, db_column='PM',
                                to_field='account', null=True, blank=True,help_text="业绩（项目）负责人")
    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")
    companyChange = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='companyChange',
                             null=True, blank=True, related_name='companyChange',help_text="企业名称变更备案附件id")
    winBid = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='winBid',
                               null=True, blank=True, related_name='winBid',help_text="中标通知书附件id")
    contractScan = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='contractScan',
                               null=True, blank=True, related_name='contractScan',help_text="合同扫描件附件id")
    contractTransfer = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='contractTransfer',
                               null=True, blank=True, related_name='contractTransfer',help_text="合同转签协议附件id")
    acceptanceCert = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='acceptanceCert',
                               null=True, blank=True, related_name='acceptanceCert',help_text="验收证书附件id")
    invoice = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='invoice',
                               null=True, blank=True, related_name='invoice',help_text="发票附件id")

    class Meta:
        db_table = 'ex_project'

#投标-公司业绩对应
class ExBidProject(models.Model):
    id = models.AutoField(primary_key=True)

    bid = models.ForeignKey(ExBid, on_delete=models.PROTECT, db_column='bid',
                                null=True, blank=True,help_text="投标任务id")
    project = models.ForeignKey(ExProject, on_delete=models.PROTECT, db_column='project',
                            null=True, blank=True,help_text="业绩id")

    class Meta:
        db_table = 'ex_bidProject'


# 投标-负责人业绩对应
class ExBidPmProject(models.Model):
    id = models.AutoField(primary_key=True)

    bid = models.ForeignKey(ExBid, on_delete=models.PROTECT, db_column='bid',
                            null=True, blank=True,help_text="投标任务id")
    project = models.ForeignKey(ExProject, on_delete=models.PROTECT, db_column='project',
                                null=True, blank=True,help_text="负责人业绩id")

    class Meta:
        db_table = 'ex_bidPmProject'

#公司证书
class ExQualification(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255,help_text="证书名称")
    code = models.CharField(max_length=255,help_text="证书编码")
    type = models.CharField(max_length=255,help_text="证书类别")
    getDate = models.DateField(help_text="获取日期")
    expirationDate = models.DateField(help_text="失效日期")

    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")
    file = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='file',
                            null=True, blank=True,help_text="附件id")

    class Meta:
        db_table = 'ex_qualification'

#公司获奖情况
class ExAward(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255,help_text="获奖名称")
    code = models.CharField(max_length=255,help_text="获奖编号")
    type = models.CharField(max_length=255,help_text="获奖类别")
    prize = models.CharField(max_length=255,help_text="获奖等级")
    level = models.CharField(max_length=255,help_text="获奖级别")
    reviewOrg = models.CharField(max_length=255,help_text="评审/评定单位")
    date = models.DateField(help_text="获奖时间")

    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")
    file = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='file',
                            null=True, blank=True,help_text="附件id")

    class Meta:
        db_table = 'ex_award'

#公司专利、软著情况
class ExPatentSoftware(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255,help_text="专利或软著名称")
    code = models.CharField(max_length=255,help_text="专利或软著编号")
    type = models.CharField(max_length=255,help_text="类型（发明专利、软著等）")
    date = models.DateField(help_text="获得时间")

    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")
    file = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='file',
                            null=True, blank=True,help_text="附件id")

    class Meta:
        db_table = 'ex_patentSoftware'

#公司信息图片
class ExBasicInfo(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255,help_text="名称")
    type = models.CharField(max_length=255,help_text="类别")
    parentPath = models.CharField(max_length=255,help_text="父路径，默认为一级节点，即为空")
    order = models.IntegerField(help_text="节点顺序")

    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")
    file = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='file',
                            null=True, blank=True,help_text="附件id")

    class Meta:
        db_table = 'ex_basicInfo'

#行贿犯罪记录表
class ExBribery(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255,help_text="名称")
    parentPath = models.CharField(max_length=255,help_text="父路径，默认为一级节点，即为空")
    order = models.IntegerField(help_text="节点顺序")

    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")
    file = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='file',
                            null=True, blank=True,help_text="附件id")

    account = models.ForeignKey(ExTeam, on_delete=models.PROTECT, db_column='account',
                                to_field='account', null=True, blank=True,help_text="用户名")

    class Meta:
        db_table = 'ex_bribery'

#诉讼仲裁记录表
class ExLawsuitArbitrate(models.Model):
    id = models.AutoField(primary_key=True)
    year = models.IntegerField(help_text="年份")
    lawsuit = models.TextField(help_text="诉讼情况")
    arbitrate = models.TextField(help_text="仲裁情况")

    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")

    class Meta:
        db_table = 'ex_lawsuitArbitrate'

#诉讼仲裁记录图片表
class ExLawsuitArbitrateResult(models.Model):
    id = models.AutoField(primary_key=True)
    startDate = models.DateField(help_text="开始年份")
    endDate = models.DateField(help_text="结束年份")
    name = models.CharField(max_length=255,help_text="名称")
    parentPath = models.CharField(max_length=255,help_text="父路径，默认为一级节点，即为空")
    order = models.IntegerField(help_text="节点顺序")

    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")
    file = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='file',
                            null=True, blank=True,help_text="附件id")

    class Meta:
        db_table = 'ex_lawsuitArbitrateResult'

#诚信和廉洁方面无不良记录的证明材料
class ExIntegrityIncorrupt(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255,help_text="名称")
    parentPath = models.CharField(max_length=255,help_text="父路径，默认为一级节点，即为空")
    order = models.IntegerField(help_text="节点顺序")

    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")
    file = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='file',
                            null=True, blank=True,help_text="附件id")

    class Meta:
        db_table = 'ex_integrityIncorrupt'

#诚信经营
class ExIntegrityManage(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255,help_text="名称")
    parentPath = models.CharField(max_length=255,help_text="父路径，默认为一级节点，即为空")
    order = models.IntegerField(help_text="节点顺序")

    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")
    file = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='file',
                            null=True, blank=True,help_text="附件id")

    class Meta:
        db_table = 'ex_integrityManage'

#财务审计
class ExFinanceAudits(models.Model):
    id = models.AutoField(primary_key=True)
    startYear = models.IntegerField(help_text="起始年份")
    endYear = models.IntegerField(help_text="结束年份")
    name = models.CharField(max_length=255,help_text="名称")
    parentPath = models.CharField(max_length=255,help_text="父路径，默认为一级节点，即为空")
    order = models.IntegerField(help_text="节点顺序")

    company = models.ForeignKey(ExCompany, on_delete=models.PROTECT, db_column='company',
                                null=True, blank=True,help_text="公司id")
    file = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='file',
                            null=True, blank=True,help_text="附件id")

    class Meta:
        db_table = 'ex_financeAudits'

#团队资质证书
class ExTeamQualification(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=255,help_text="证书名称")
    number = models.CharField(max_length=255,help_text="证书编号")
    type = models.CharField(max_length=255,help_text="证书类型")
    level = models.CharField(max_length=255,help_text="证书级别")
    getDate = models.DateField(help_text="获取日期")
    expirationDate = models.DateField(help_text="失效日期")

    account = models.ForeignKey(ExTeam, on_delete=models.PROTECT, db_column='account',
                                to_field='account', null=True, blank=True,help_text="用户名")
    file = models.ForeignKey(ExFile, on_delete=models.PROTECT, db_column='file',
                            null=True, blank=True,help_text="团队证书附件id")

    class Meta:
        db_table = 'ex_teamQualification'

#团队工作经历
class ExTeamWork(models.Model):
    id = models.AutoField(primary_key=True)
    begin = models.DateField(help_text="开始日期")
    end = models.DateField(help_text="结束日期")
    work = models.CharField(max_length=255,help_text="工作内容")
    role = models.CharField(max_length=255,help_text="担任职务")
    account = models.CharField(max_length=255,help_text="用户名")

    # account = models.ForeignKey(ExTeam, on_delete=models.PROTECT, db_column='account',
    #                             to_field='account', null=True, blank=True,help_text="单位地址")

    class Meta:
        db_table = 'ex_teamWork'

#团队参与项目
class ExTeamProject(models.Model):
    id = models.IntegerField(primary_key=True,help_text="单位地址")
    year = models.IntegerField(help_text="年份")
    projectContent = models.CharField(max_length=255,help_text="参与项目")
    account = models.CharField(max_length=255,help_text="用户名")

    # account = models.ForeignKey(ExTeam, on_delete=models.PROTECT, db_column='account',
    #                             to_field='account', null=True, blank=True,help_text="单位地址")

    class Meta:
        db_table = 'ex_teamProject'